<!DOCTYPE html>
<html lang="UTF-8">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
    <title>{% block pageTitle %}{{ this.di.get('moduleConfig').application.id }}{% endblock %}</title>
    <meta name="author" content="ice.deng">
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" type="text/css" href="/libs/bootstrap-3.3.4/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="/libs/font-awesome-4.4.0/css/font-awesome.min.css" />
    <link rel="stylesheet" type="text/css" href="/assets/manage/css/main.css" />
    <link rel="stylesheet" type="text/css" href="/libs/validator-0.7.3/jquery.validator.css" />
    <script type="text/javascript" src="/libs/jquery/jquery-2.1.4.min.js"></script>
    {% block pageHeader %}{% endblock %}
</head>
<body style="text-align:center;">

{% block pageFooter%}
{% endblock %}

{% block content %}
<div class="col-xs-10" style="margin-top:20px;">
    <div class="">
        <div class="panel-body" style="border:none;">
            <form class="form-horizontal" action="" method="post" id="form_update" role="form" onsubmit="return false;">
            <input type="hidden" name="callback" value="parent.setFormResult">
                <div class="form-group">
                    <div class="input-group">
                        <label class="input-group-addon">专题排序：</label>
                        <select class="form-control" name="sort" >
                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                        </select>
                    </div>
                    <div style="width:100%; height:30px;"></div>
                    <input type="hidden" name="id" value="<?=$id?>">
                    <div class="input-group">
                        <label class="input-group-addon">推荐城市：</label>
                        <select class="form-control" name="cityid" >
                        	{% for oc in openCity %}
                            	<option value="{{ oc.city_id }}" >{{ oc.city_name|e }}</option>
                            {% endfor %}
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-primary" onclick="commit();"><i class="fa fa-filter"></i> 确定</button>
                </div>
            </form>
        </div>
    </div>
</div>
{% endblock %}

<script type="text/javascript" src="/libs/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/libs/validator-0.7.3/jquery.validator.js"></script>
<script type="text/javascript" src="/libs/validator-0.7.3/local/zh_CN.js"></script>
<script type="text/javascript" src="/libs/layer-v1.9.3/layer.js"></script>
<script type="text/javascript" src="/assets/manage/js/footer.js"></script>
<script>
function commit(){
	var cityid=$("select[name=cityid]").val();
	var sort=$("select[name=sort]").val();
	var id=$("input[name=id]").val();
	var index = layer.load(0, {shade: false});
	$.ajax({
		type: "POST",
		url: "/manage/beautycanon/recommend",
		data: {cityid:cityid,sort:sort,id:id},
		dataType:"json",
		success: function(param){
			if(param.status!=1){
				layer.closeAll();
				layer.alert('排序错误或城市已有三个！', {icon: 6});
			}else{
				layer.confirm('推荐成功！', {
/*				    btn: ['继续添加','返回列表'] //按钮*/
				    btn: '返回列表' //按钮
				},/*, function(){
					location.reload(true);
				}, */function(){
					parent.location.reload(true);
				});
			}
		}
	});	
}
</script>
</body>
</html>